
<script src="__PUBLIC__/Intesys/default/javascripts/jquery-1.10.2.min.js" type="text/javascript"></script><script src="__PUBLIC__/Js/validform/Validform.js"></script>
<link rel="stylesheet" type="text/css" href="/Public/Js/mobiscroll/css/mobiscroll.custom-2.5.2.min.css">

<form role="form" method="post" action="{:U('Analysis/department')}" class="checkoutform"><!---->
    <div class="col-lg-12 col-sm-12">
        <div class="heading" style="position:inherit">
            <label class="radio-inline"><input name="time" type="radio" value="year" <empty name="time">checked=''</empty><if condition="$time eq year"> checked="" </if> > <span>本年</span></label>
            <label class="radio-inline"><input name="time" type="radio" value="month" <if condition="$time eq month"> checked="" </if> > <span>本月</span></label>
            <label class="radio-inline"><input  name="time" type="radio" value="week" <if condition="$time eq week"> checked="" </if> ><span>本周</span></label>
            <label class="radio-inline"><input  name="time" type="radio" value="day" <if condition="$time eq day"> checked="" </if> ><span>当天</span></label>
            <label class="radio-inline"><input name="time" type="radio" value="defined" id="timecheck" <if condition="$time eq defined"> checked="" </if> ><span>自定义</span></label>　　
            <input class="form-control" id="starttime" name="starttime" readonly onclick="WdatePicker();" style="cursor:pointer;display: inline;width:150px" value="{$start}" placeholder="起始时间" type="text" class="col-lg-2 col-sm-2"> -
            <input class="form-control" id="endtime" name="endtime" onclick="WdatePicker();" readonly style="cursor:pointer;display:inline;width:150px" value="{$end}" placeholder="结束时间" type="text" class="col-lg-2 col-sm-2">
        </div>
    </div>
    <script>
        $(document).ready(function(){
            //点击时间区间，自动选择自定义
            $("input[name = 'starttime']").click(function () {
                $('#timecheck').attr('checked', 'checked');
            });
            $("input[name = 'endtime']").click(function () {
                $('#timecheck').attr('checked', 'checked');
            });
        });
    </script>
    <div class="col-lg-4 col-sm-4">
        <div class="widget-container">
            <div class="heading">
                    <div class="form-group">
                        <div class=" row">
                            <label class="checkbox-inline"><input name="area[]" <empty name="area">checked=''</empty>
                                <if condition="$area eq 0"> checked="" </if>   type="checkbox" value="0"><span>全公司</span></label><volist name="detype" id="detype">
                                <label class="checkbox-inline"><input  name="area[]"
                                    <php>if(in_array($detype['id'],$area)){
                                        echo "checked='' ";}</php>
                                    type="checkbox" value="{$detype.id}"><span>{$detype.title}</span></label>
                            </volist>
                        </div>
                    </div>
                    <hr>
                    <div class="form-group">
                    <div class="row">
                        <label class="checkbox-inline"><input type="checkbox" <empty name="type" >checked=''</empty> <if condition="$type eq 0"> checked=''  </if>  name='type[]' value="0">
                            <span>所有积分</span>
                        </label><volist name="form" id="form" >
                            <label class="checkbox-inline"><input type="checkbox" name='type[]'
                                   <php>if(in_array($form['id'],$type)){echo "checked='' ";}</php>
                                                                  value="{$form.id}">
                                <span>{$form.name}</span>
                            </label>
                        </volist>
                        <script>
                            $(document).ready(function(){

                                //部门 选择
                                $("input[name = 'area[]'][value = '0']").click(function(){
                                    $("input[name = 'area[]'][value != '0']").removeAttr('checked');
                                });
                                $("input[name = 'area[]'][value != '0']").click(function(){
                                    $("input[name = 'area[]'][value = '0']").removeAttr('checked');
                                });

                                //积分类型 选择
                                $("input[name = 'type[]'][value = '0']").click(function(){
                                    $("input[name = 'type[]'][value != '0']").removeAttr('checked');
                                });
                                $("input[name = 'type[]'][value != '0']").click(function(){
                                    $("input[name = 'type[]'][value = '0']").removeAttr('checked');
                                });
                            });
                        </script>
                    </div>
                    </div>
                    <div class="form-group" style="text-align:center">
                        <a class="btn btn-sm btn-info " style="margin:0;padding:5px 15px;border-radius:0" onclick="window.location='{:U("getExcel",array('time'=>$time,'starttime'=>$starttime,'endtime'=>$endtime,'type'=>$type,'area'=>$newarea))}'">导出表格</a>
                        <button class="btn btn-sm btn-info " style="margin:0;padding:5px 15px;border-radius:0">点击搜索</button>
                    </div>
            </div>
        </div>
    </div>

</form>
    <div class="col-lg-8 col-sm-8">
        <div class="widget-container fluid-height clearfix">
            <table class="table table-hover">
                <thead>
                    <th>姓名</th>
                    <th>职位</th>
                    <th>得分</th>
                </thead>
                <tbody>
                <volist name="department" id="dep">
                    <tr>
                        <td>
                            <notempty name="dep.name">
                                {$dep.name}
                                <else />{$dep.nickname}
                            </notempty>
                        </td>
                        <td>{$dep.job}</td>
                        <td>{$dep.sum}</td>
                    </tr>
                </volist>
                </tbody>
            </table>
        </div>
    </div>
</div>

<script>
//    $.cookie('loadIndexUrl', window.location.href, {path:'/'});
    $(".checkoutform:eq(0)").Validform({
        ajaxPost:true,
        tiptype:function(data,s){
            if(s.type == 1){
            }
        },
        datatype:{
            "text":function(gets,obj,curform,regxp){return true;},
            "image":function(gets,obj,curform,regxp){return true;}
        },
        callback:function(data){
            $('.ThinkBox-close').trigger('click');
                //更新列表
            $('.dept4').html(data.tbody);
        }
    });
</script>
<script>
    $(document).ready(function(){
        $('a.dopa').each(function(){
            $(this).on('click',function(){
                var checkout=$(this).attr('rel');
                $.post("{:U('Analysis/department')}",{time:checkout},function(data){
                    $('.dept4').html(data.tbody);
                },'JSON');
            });
        });
    });
</script>
